#include "RenderEngine.h" 
#include "Paras.h"
#include "BufferFactory.h"
#include "FontFactory.h"
#include "TextureFactory.h"
#include "RenderSystem.h"
#include "SceneManager.h"
#include "ZIPManager.h"

//
namespace Euclid
{
	RenderEngine::RenderEngine()
		: _renderSystem(0), _fontFactory(0)
	{

	}

	RenderEngine::~RenderEngine()
	{

	}

	IRenderSystem* RenderEngine::getRenderSystem()
	{
		return _renderSystem;
	}

	bool RenderEngine::create()
	{
		//
		_renderSystem = new RenderSystem;
		if (NULL == _renderSystem)
		{
			return false;
		}

		//
		if (!_renderSystem->create())
		{
			return false;
		}
		
		//
		Paras::getSingletonPtr()->_renderSystem = _renderSystem;

		//
		return true;
	}

	void RenderEngine::destroy()
	{
		//
		if (_renderSystem)
		{
			_renderSystem->destroy();
		}

		//
	}

	IFontFactory* RenderEngine::getFontFactory()
	{
		return FontFactory::getSingletonPtr();
	}

	ITextureFactory* RenderEngine::getTextureFactory()
	{
		return TextureFactory::getSingletonPtr();
	}

	IBufferFactory* RenderEngine::getBufferFactory()
	{
		return BufferFactory::getSingletonPtr();
	}

	ISceneManager* RenderEngine::getSceneManager()
	{
		return SceneManager::getSingletonPtr();
	}

	IZIPManager* RenderEngine::getZIPManager()
	{
		return ZIPManager::getSingletonPtr();
	}
}